package com.jn.singleton.type8;

/**
 * @author 江南大学1033190417
 * @date 2022/4/10 16:28
 */
public class SingletonTest08 {
    public static void main(String[] args) {
        Singleton instance = Singleton.INSTANCE;
        Singleton instance1 = Singleton.INSTANCE;
        System.out.println(instance1 == instance);//true
        System.out.println(instance.hashCode());
        System.out.println(instance1.hashCode());//相同
        instance.sayOK();
    }
}


 enum Singleton{
    INSTANCE;//属性
    public void sayOK(){
        System.out.println("hello");
    }
 }
